home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wcomm111.zip / TCP.ZIP / TERM.CPP < prev    next >
C/C++ Source or Header  |  1991-02-02  |  1KB  |  40 lines

  1. //          Warp Communications Library
  2. //          Copyright (C) 1991 Trevor Bell, All Rights Reserved
  3.  
  4.  
  5. #include <conio.h>
  6. #include <stdio.h>
  7. #include <process.h>
  8. #include <iostream.h>
  9. #include "warpcomm.hpp"
  10.  
  11. int main(void)
  12. {
  13.     char ch=0, ch2=0;
  14.     clrscr();
  15.     cout << "A simple terminal program for the Warp Communications Library (Ctrl-C to exit)\r\n";
  16.     cout << "Copyright (C) 1991 Trevor Bell, All Rights Reserved\r\n\n";
  17.  
  18.     remote[0].open(0, 2400, 4, 0x3F8, 2000, 2000);
  19.     // opens com port 1 at 2400 baud, IRQ 4, base address 3F8 (hex) with
  20.     // 2000 byte transmit and receive buffers
  21.  
  22.     remote[0].send_modem_string("ATZ|");
  23.     // initialize the modem
  24.  
  25.     while(ch != 3) {
  26.         if(kbhit()) {           // checks for a keypress
  27.             ch=getch();         // gets a keypress
  28.             remote[0] << ch;       // sends a character to the com port
  29.         }
  30.         if(remote[0].char_waiting()) {
  31.         // checks to see if a character is waiting at the com port
  32.  
  33.             remote[0] >> ch2;      // gets a character from the com port
  34.             putch(ch2);         // outputs the character onto the screen
  35.         }
  36.     }
  37.     remote[0].close();             // closes the com port
  38.     exit(0);                    // exits with errorlevel 0
  39. }
  40.